import { ref, onMounted } from 'vue';

export function usePageAnimation() {
  const animateIn = ref(false);
  const animateOut = ref(false);

  onMounted(() => {
    setTimeout(() => {
      animateIn.value = true;
    }, 10);
  });

  function triggerExitAnimation(navigateBack: () => void) {
    animateOut.value = true;
    setTimeout(() => {
      navigateBack();
    }, 300);
  }

  return {
    animateIn,
    animateOut,
    triggerExitAnimation
  };
}
